//https://github.com/gone369/sass-themify

window.onload = function () {
  const themeColors = document.querySelectorAll(".theme-color");

  const setTheme = (theme) => {
    document.body.className = theme;
    localStorage.setItem("theme", theme);
  };

  const getTheme = () => {
    let theme = localStorage.getItem("theme");
    if (theme) setTheme(theme);
  };



  themeColors.forEach((themeName) => {
    themeName.addEventListener("click", (e) => {
      const thisTheme = themeName.getAttribute("data-color");
      setTheme(e.target.value);
    });
  });

  getTheme();
};

// window.onload = function () {
  // const setTheme = (theme) => {
  //   document.documentElement.className = theme;
  //   localStorage.setItem("theme", theme);
  // };

  // const getTheme = () => {
  //   let theme = localStorage.getItem("theme");
  //   if (theme) setTheme(theme);
  // };

  // document.addEventListener("DOMContentLoaded", (e) => {
  //   getTheme();

  //   document.getElementById("theme-select").addEventListener("change", (e) => {
  //     setTheme(e.target.value);
  //   });
  // });
// };
